﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Display.NeighborUI {
    import flash.display.*;
    import flash.utils.*;
    import Display.DialogUI.*;
    import Classes.*;
    import Classes.util.*;

    public class FriendFTVRewardDialog extends GenericDialog {

        private var m_friend:Player;
        private var m_coins:int;
        private var m_energy:int;
        private var m_xp:int;
        private var m_firstTime:Boolean = false;
        protected var m_acceptTextName:String;
        protected var m_imagePath:String;
        protected var m_bg:DisplayObject;
        protected var numAssetsLeft:int = 2;

        public function FriendFTVRewardDialog(_arg1:Player, _arg2:int=0, _arg3:int=0, _arg4:int=0, _arg5:Function=null, _arg6:Boolean=true){
            this.m_friend = _arg1;
            this.m_coins = _arg2;
            this.m_energy = _arg3;
            this.m_xp = _arg4;
            this.m_acceptTextName = "Okay";
            this.m_firstTime = (_arg2 == Global.gameSettings.getInt("initialFriendVisitRewardCoins", 0));
            if (_arg2 == Global.gameSettings.getInt("initialFriendVisitReward2Coins", 0)){
                this.m_firstTime = true;
            };
            if (_arg2 == Global.gameSettings.getInt("friendVisitRewardCoins", 0)){
                this.m_firstTime = false;
            };
            this.m_imagePath = (this.m_firstTime) ? "assets/neighbor_visit/neighborVisit_bus.png" : "assets/neighbor_visit/neighborVisit_sam.png";
            var _local7:String = (this.m_firstTime) ? ZLoc.t("Dialogs", "VRFriendBenefits_title") : ZLoc.t("Dialogs", "neighborVisit_title");
            var _local8 = "";
            if (this.m_firstTime){
                _local8 = ZLoc.t("Dialogs", "VRWhileVisitingFT", {name:ZLoc.tn(this.m_friend.snUser.firstName)});
            } else {
                _local8 = ZLoc.t("Dialogs", "VRWhileVisiting", {name:ZLoc.tn(this.m_friend.snUser.firstName)});
            };
            super(_local8, "", 0, _arg5, _local7, "", _arg6, 0, "", null, "", true);
        }
        override protected function loadAssets():void{
            Global.delayedAssets.get(DelayedAssetLoader.GENERIC_DIALOG_ASSETS, this.onLoadDialogAssets);
            Global.delayedAssets.get(this.m_imagePath, this.onLoadPictureAsset);
        }
        override protected function createAssetDict():Dictionary{
            var _local1:Dictionary = new Dictionary();
            _local1["dialog_bg"] = (new m_comObject.dialog_bg() as DisplayObject);
            _local1["image"] = this.m_bg;
            _local1["friend"] = this.m_friend;
            return (_local1);
        }
        override protected function createDialogView(_arg1:Dictionary):GenericDialogView{
            var _local2:FriendFTVRewardDialogView = new FriendFTVRewardDialogView(_arg1, this.m_coins, this.m_energy, this.m_xp, m_message, m_dialogTitle, m_type, m_callback, this.m_firstTime);
            return (_local2);
        }
        protected function onLoadDialogAssets(_arg1:DisplayObject, _arg2:String):void{
            m_comObject = _arg1;
            this.checkAssetsLoaded();
        }
        protected function onLoadPictureAsset(_arg1:DisplayObject, _arg2:String):void{
            this.m_bg = _arg1;
            this.checkAssetsLoaded();
        }
        protected function checkAssetsLoaded():void{
            if (--this.numAssetsLeft == 0){
                onAssetsLoaded();
            };
        }

    }
}//package Display.NeighborUI 
